home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / BTGETLCK.C < prev    next >
Text File  |  1991-09-23  |  1KB  |  52 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)btgetlck.c    1.5 - 91/09/23" */
  5.  
  6. #include <ansi.h>
  7.  
  8. /* local headers */
  9. #include "btree_.h"
  10.  
  11. /*man---------------------------------------------------------------------------
  12. NAME
  13.      btgetlck - get btree lock status
  14.  
  15. SYNOPSIS
  16.      #include <btree.h>
  17.  
  18.      int btgetlck(btp)
  19.      btree_t *btp;
  20.  
  21. DESCRIPTION
  22.      The btgetlck function reports the lock status of a btree.  The
  23.      btp argument is an open btree.  The function returns the status
  24.      of the lock currently held by the calling process.  Locks held by
  25.      other processes are not reported.
  26.  
  27.      The possible return values are:
  28.  
  29.           BT_UNLCK     btree not locked
  30.           BT_RDLCK     btree locked for reading
  31.           BT_WRLCK     btree locked for reading and writing
  32.  
  33. SEE ALSO
  34.      btlock.
  35.  
  36. ------------------------------------------------------------------------------*/
  37. #ifdef AC_PROTO
  38. int btgetlck(btree_t *btp)
  39. #else
  40. int btgetlck(btp)
  41. btree_t *btp;
  42. #endif
  43. {
  44.     if (!(btp->flags & BTLOCKS)) {
  45.         return BT_UNLCK;
  46.     } else if (btp->flags & BTWRLCK) {
  47.         return BT_WRLCK;
  48.     }
  49.  
  50.     return BT_RDLCK;
  51. }
  52.